Goal of recitations

  • Get better at looking for information
  • Get better at google “How to … in ggplot”
  • Each recitation will try to make you more independent in class exercise

Goal of this recitation

  • Modify the notebook appereance
  • Modify the output/behavior of code chunks
  • Insert images/videos

Modifying notebook appereance

Why to modify the notebook appeareance

  • Helps to get users attention
  • Creates a better looking documents
  • Use your favorite colors (Kind of)

Modifying notebook appereance

Default rmarkdown theme

Modifying notebook appereance

Using themes to customize notebook appearance

Cayman

Leonids

Rmakrdown themes from prettydoc package

Themes- How themes work?

Add a layer of makeup on our notebooks

Default

Cayman

Default vs Leonids theme

Themes- What are they?

Ire a predefined set of style layers of CSS code that controls and modifies how HTML elements are presented.

Hands on: Themes

YAML example

Rmkarkdown documentation here

Notebok theme gallery here

---
title: Your awesome title
author: Your name
date: Some day
output:
  rmarkdown::html_document:
     theme: lumen
---

Using prettydoc package

You can find help about the cayman theme here

---
title: Your awesome title
author: Your name
date: Some day
output:
  ?---
     ?---
---

Modifying chunks behaviour

I want to …

  • Include the output but not the code
  • Include the code but not the output
  • Run code but include nothing

Code chunk options

Documentation information here

  • There is a lot to modify in chunks

Chunk options toolbar

We can use the toolbar at the right side of the chunk.

Turning warning and messages off

  • Let’s try with libray(tidyverse)

Warning and message turn off

Text output echo

Boolean (TRUE or FALSE) whether to include the source code in the document

Code evaluation eval

  • Boolean (TRUE or FALSE) whether to evaluate (run) the code.
  • Default eval=TRUE
  • Source code is included in the output document despite eval value

Code evaluation eval

Adding images

Structure of the directory

It is suggested to have a img directory to save all images to be used in your notebook.

Directory structure

Rmarkdown code

![Caption text](path to image){image styel modification}
![Directory structure](img/img_directory.png){fig-aling="center"}

Directory structure

Hands on: Adding images

  • Create a img directory inside your working directory
  • Select and save an image inside the img directory
  • Add the image to your notebook